Repository navigation
[SDT-0002]: move ServiceContext from SSC to SDT implementation - #240
Conversation
72d78ea to
2f61cd5
Compare
czechboy0
left a comment
There was a problem hiding this comment.
Did we consider putting the new types into one of the existing modules? Why do we want it in a separate one?
|
@kukushechkin would you mind tacking on diff --git a/.spi.yml b/.spi.yml
index 26f45b2..ea570cd 100644
--- a/.spi.yml
+++ b/.spi.yml
@@ -1,4 +1,4 @@
version: 1
builder:
configs:
- - documentation_targets: [Tracing, Instrumentation, InMemoryTracing]
+ - documentation_targets: [Tracing, Instrumentation, InMemoryTracing, ContextStorage] |
Co-authored-by: Joseph Heck <j_heck@apple.com>
@czechboy0 no, did not think about it. It feels it should be in a separate module. What is the downside of have a new module? |
I feel that the default should be not to separate into a separate module, unless we have a good reason. Do we? |
I agree with Honza to put it in |
|
@czechboy0 @slashmo UPD. Ah, wait, no, |
|
Hm, yeah. We need it for the context propagation requirement of |
Also works. @czechboy0 wdyt? |
|
Works for me. |
|
Sounds fine to me, while keeping a typealias for compatibility I guess right? |
czechboy0
left a comment
There was a problem hiding this comment.
One last docs fix, otherwise lgtm
Co-authored-by: Honza Dvorsky <honza@apple.com>
…tion (#92) Turn this package into a thin compatibility layer over swift-distributed-tracing. ## Motivation: Companion to apple/swift-distributed-tracing#240. `ServiceContext`'s implementation moved there, renamed to `TracingContext`. This package now re-exports it instead of owning it. ## Modifications: - Added a dependency on swift-distributed-tracing. - `ServiceContextModule` re-exports its `ContextStorage` module and declares its own non-deprecated `ServiceContext`/`ServiceContextKey`/`AnyServiceContextKey` typealiases. - Moved the behavior test suite to swift-distributed-tracing. - Add a compatibility smoke test. - Updated the README to point new adopters at swift-distributed-tracing directly. ## Result: `import ServiceContextModule` keeps working with no code changes and no deprecation warning, even in a file that also imports `Tracing` directly. New code should depend on swift-distributed-tracing and use `TracingContext` instead.
### Motivation `swift-distributed-tracing` 1.6.0 moved `ServiceContext` into its `Instrumentation` module and renamed it `InstrumentationContext` (apple/swift-distributed-tracing#240). `Tracing` no longer pulls in `swift-service-context`, so the Temporal target's `import ServiceContextModule`, which only worked because older `Tracing` versions brought that module in, now fails whenever the latest versions are resolved: ``` TemporalHeaderPropagation.swift:15:8: error: no such module 'ServiceContextModule' ``` This breaks CI on main and on every open PR. ### Modifications - Add `swift-service-context` as a direct dependency of `Temporal` and `TemporalTests`. - Import `ServiceContextModule` in every file that uses `ServiceContext`. `swift-service-context` 1.4.0 keeps `ServiceContext` as a non-deprecated alias for `InstrumentationContext`. Importing it makes that alias win over the deprecated one in `Tracing`. The SDK therefore keeps working with `swift-distributed-tracing` 1.2.0 and later, without requiring 1.6.0. ### Result The SDK builds again against both old and new `swift-distributed-tracing` versions, and adopters aren't forced to upgrade. ### Test Plan Built with `-warnings-as-errors` and ran the tracing interceptor and OTel tests against `swift-distributed-tracing` 1.6.0 with `swift-service-context` 1.4.0, and against 1.4.1 with 1.3.0.
Move
ServiceContextfrom swift-service-context asInstrumentation.InstrumentationContext. Implements SDT-0002, companion to apple/swift-service-context#92.Motivation:
ServiceContextlived in its own package mainly for swift-distributed-tracing users, adding release overhead for little benefit. The name also reads as server-specific, discouraging non-server adoption.Modifications:
ServiceContexttoInstrumentation.ServiceContext/ServiceContextKey/AnyServiceContextKeytoInstrumentationContext/InstrumentationContextKey/AnyInstrumentationContextKey, keeping deprecated typealiases for old symbols.Result:
Existing code keeps compiling unchanged. Direct dependents using the old names get a deprecation warning with a fix-it; swift-service-context dependents get none, by design.
diagnose-api-breaking-changesreports breaking changes acrossTracing/Instrumentation/InMemoryTracing, all "type changed toInstrumentation.InstrumentationContext". This is expected — typealiases are transparent to the type system, so this shows up no matter which name call sites use, and we don't target ABI stability here, only source-compatibility.